const Mock = require("mockjs");
const Random = Mock.Random;

// 字典列表
const dictionaryList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "dictName": Random.cword(2, 5),
      "dictCode": Random.word(3, 8),
      "children": []
    };
    for (let m = 0; m < 8; m++) {
      const child = {
        "dictName": Random.cword(2, 5),
        "dictCode": obj.dictCode,
        "typeCode": Random.word(3, 8)
      };
      obj.children.push(child);
    }
    list.push(obj);
  }
  return list;
};
Mock.mock("/mock/getDictionaryList", dictionaryList);

// 字典值列表
const dictionaryValueList = function () {
  const list = [];
  for (let i = 0; i < 20; i++) {
    const obj = {
      "id": Random.id(),
      "label": Random.cword(2, 5),
      "value": Random.word(3, 8),
      "order": i,
      "status": Random.boolean(),
      "lastEditor": Random.cname(),
      "updatedAt": Random.datetime("yyyy-MM-dd HH:mm:ss")
    };
    list.push(obj);
  }
  return list;
};
Mock.mock("/mock/getDictionaryValueList", dictionaryValueList);
